#ifndef __SENSOR_BATTERY_H__
#define __SENSOR_BATTERY_H__

#define SENSOR_BATTERY_CHECK_PIN (18) //P18
#define SENSOR_BATTERY_CHECK_SAMPLE_RATE (100)

#define SENSOR_BATTERY_LOW_LEVEL (2500) //unit mV
#define SENSOR_BATTERY_SAVE_COUNT (5)

#define SENSOR_BATTERY_DEFAULT_VALUE (3000)
#define SENSOR_BATTERY_VALID_MIN (1600)
#define SENSOR_BATTERY_VALID_MAX (3600)

typedef struct _battery_s
{
    adc_dev_t battery_check;
    uint8_t count;
    uint32_t value[SENSOR_BATTERY_SAVE_COUNT];
} battery_t;

int32_t sensor_get_battery_level(uint32_t *battery_level);
int32_t sensor_battery_init(void);

#endif
